HL7 V2 ADT Process API - Implementation Template
Developer guide
ADT Application Dev Guide
The SFDC ADT application uses the following DataWeave modules to map between HL7 and HealthCloud formats.
| Module | Description |
|---|---|
| address | Maps the FHIR address object. |
| addresstype | Maps the address type object. |
| allergycriticality | Maps the allergy criticality. |
| allergytype | Maps the allergy type. |
| codeableconcept | Maps the CodeableConcept object. |
| doctors | This module defines some common functions to support doctor lookups and processing. |
| driverlicensenumber | Maps the driver license number object. |
| extendedpersonname | Maps the extended person name object. |
| extendedtelecommunicationnumber | Maps the extended telecommunication number object. |
| gender | Maps the gender object. |
| identifier | Maps the FHIR identifier object. |
| idtypes | Maps the ID type object. |
| LibADT | This module defines functions needed to convert an HL7 ADT message into the HealthCloud data model. |
| maritalstatus | Maps the marital status object. |
| nametype | Maps the name type object. |
| telecomequipmenttype | Maps the Telecom Equipment Type object. |
| telecomusecode | Maps the telecom use code object. |
| util | This module defines a number of common utility functions. |
address
Maps the FHIR address object.
Source:
.src/main/resources/dw/resources/datatypes/address.dwl
Functions
fun mapAddress (obj)
Maps the provided object to the FHIR address.
param
objis an object with XAD fields that can be mapped to an address. (ORC-22, RXA-28 ...)
return A FHIR formatted Address object.
addresstype
Maps the address type object.
Source:
.src/main/resources/dw/resources/codesystem/addresstype.dwl
Functions
fun mapAddressType (code)
Maps the provided XAD-07 field to the proper address type object.
param
codeis a XAD-07 field to map.
return An address type object.
allergycriticality
Maps the allergy criticality.
Source:
.src/main/resources/dw/resources/codesystem/allergycriticality.dwl
Functions
fun mapAllergyCriticality (code)
Maps the provided code to the allergy criticality.
param
codeis a string with the criticality code.
return An AllergyCriticality object.
allergytype
Maps the allergy type.
Source:
.src/main/resources/dw/resources/codesystem/allergytype.dwl
Functions
fun mapAllergyType (code)
Maps the allergy type with the provided code.
param
codeis a string with the allergy type code.
return An AllergyType object.
codeableconcept
Maps the CodeableConcept object.
Source:
.src/main/resources/dw/resources/datatypes/codeableconcept.dwl
Functions
fun mapCodeableConcept (obj)
Maps the provided object into a CodeableConcept object.
param
objis the object to map from.
return A CodeableConcept object.
fun mapCodeableConcept (obj, hasMappingFunct, mappingFunct)
Maps the provided object with the provided mapping function into a CodeableConcept object.
param
objis the object to map from.
paramhasMappingFunctis a boolean with true for has a provided mapping function and false for not. If set to true mappingFunct must be a vaild mapping function reference.
parammappingFunctis a function reference with the function to call to provide the mapping. This function definition must take a single argument.
return A CodeableConcept object.
fun mapCodeableConceptDoMapping (obj, hasMappingFunct, mappingFunct)
This function produces the codeable concept mappings. It's broken out into it's own function so it can be called multiple times from mapCodeableConcept.
param
objis the object to map from.
paramhasMappingFunctis a boolean with true for has a provided mapping function and false for not. If set to true mappingFunct must be a vaild mapping function reference.
parammappingFunctis a function reference with the function to call to provide the mapping. This function definition must take a single argument.
return A CodeableConcept object.
doctors
This module defines some common functions to
support doctor lookups and processing.
Source:
.src/main/resources/dw/resources/doctors.dwl
Functions
fun createQuery (doctorIds)
Creates the HC query to get the IdValue and ParentRecordId from the Identifier table with the supplied list of values.
param
doctorIdsis a list of doctor Ids to query.
return A HC query string.
fun processQueryResults (idList, queryResult)
Processes the HC query results along with the provided Id list to create a list of parent record Ids that matches up with the provided idList identifier values. If a query result for a provided idList value isn't present then a null placeholder is put in it's place in the output.
param
idListis a list of the Id values to create a HC list for.
return A list of HC Ids that match up to the input idList with nulls set where no value was found.
fun createHealthcareProviderQuery (doctorIds)
Creates the HC query to get the AccountId and Id from the HealthcareProvider table with the supplied list of values.
param
doctorIdsis a list of doctor Account Ids to query.
return A HC query string.
fun processHealthcareProviderQueryResults (idList, queryResult)
Processes the HC query results along with the provided Id list to create a list of HealthcareProvider Ids that matches up with the provided Account Id values. If a query result for a provided idList value isn't present then a null placeholder is put in it's place in the output.
param
idListis a list of the Id values to create a HC list for.
return A list of HealthcareProvider Ids that match up to the input Account Id list with nulls set where no value was found.
driverlicensenumber
Maps the driver license number object.
Source:
.src/main/resources/dw/resources/datatypes/driverlicensenumber.dwl
Functions
fun mapDriverLicenseNumber (obj)
Maps the driver license number object with the provided PID PID-20 object.
param
objis a PID-20 object.
return A DriverLicenseNumber object.
extendedpersonname
Maps the extended person name object.
Source:
.src/main/resources/dw/resources/datatypes/extendedpersonname.dwl
Functions
fun mapExtendedPersonName (xpn)
Maps the extended person name with the provided XPN object.
param
xpnis an XPN object.
return An ExtendedPersonName object or null if xpn is null.
extendedtelecommunicationnumber
Maps the extended telecommunication number object.
Source:
.src/main/resources/dw/resources/datatypes/extendedtelecommunicationnumber.dwl
Functions
fun mapExtendedTelecommunicationNumber (xtn)
Maps the extended telecommunication number with the provided xtn object.
param
xtnis the provided object to map.
return An ExtendedTelecommunicationNumber object.
gender
Maps the gender object.
Source:
.src/main/resources/dw/resources/codesystem/gender.dwl
Functions
fun mapGender (code)
Maps the gender with the provided code.
param
codeis a string with the code to map.
return A Gender object.
identifier
Maps the FHIR identifier object.
Source:
.src/main/resources/dw/resources/datatypes/identifier.dwl
Functions
fun mapIdentifier (cx)
Maps the provided object to the FHIR identifier object.
param
cxis the input object to map.
return An identifier object.
idtypes
Maps the ID type object.
Source:
.src/main/resources/dw/resources/codesystem/idtypes.dwl
Functions
fun mapIdTypes (code)
Maps the ID type with the provided code.
param
codeis a string with the ID type.
return An IdType object.
LibADT
This module defines functions needed to convert an
HL7 ADT message into the HealthCloud data model.
Source:
.src/main/resources/dw/hl7/LibADT.dwl
Functions
fun getMRN (msg)
This function takes ADT message and locates the MRN number.
param
msgis an ADT message.
return The MRN number or null if not found.
fun getResultIds (res)
This function takes the results of a Salesforce query and returns a list of IDs.
param
resis a Salesforce query result.
return An array with a list of Ids found.
fun getCompositeResponseId (data, refId)
Gets the Id returned in the composite response for the provided reference Id.
param
datais the composite reponse.
paramrefIdis a string with the referenceId to match on.
return A string with the Id or null if not found.
fun stripBlankCompositeRequests (compositeRequests)
Removes any composite requests where the number of items are less then or equal to 1. This is to remove blank requests.
param
compositeRequestsis the list of composite requests to strip.
return A list of composite requests.
fun getPersonAccount (msg, recordType)
Converts the provided ADT request message to the HealthCloud PersonAccount request object.
param
msgis an ADT message.
paramrecordTypeis an ID with the PersonAccount record ID to use.
return A HealthCloud PersonAccount request object.
fun getAccount (msg)
Converts the provided ADT request message to the HealthCloud Account object.
param
msgis an ADT message.
return A HealthCloud Account object.
fun getPersonName (msg, accountId)
Converts the provided ADT request message to the HealthCloud PersonName object list.
param
msgis an ADT message.
paramaccountIdis a string with the Account Id.
return A HealthCloud PersonName object list.
fun hcConvertPersonName (fhirObjList, accountId)
Converts the provided list of FHIR formatted patient names to the HealthCloud PersonName object list.
param
msgis an ADT message.
paramaccountIdis a string with the Account Id.
return A list of HealthCloud PersonName objects.
fun getIdentifiers (msg, idTypeIdMap, accountId)
Converts the provided ADT request message to the HealthCloud Identifier object list.
param
msgis an ADT message.
paramidTypeIdMapis an object with the IdType code -> IdType Id from HealthCloud map.
paramaccountIdis a string with the Account Id.
return A HealthCloud Identifier object list.
fun hcConvertIdentifier (pid)
Converts the provided PID segment to a list of FHIR formatted identifier objects.
param
pidis a HL7 PID segment to get the identifiers from.
return A list of FHIR formatted identifier objects.
fun getContact (msg)
Converts the provided ADT request message to the HealthCloud Contact object.
param
msgis an ADT message.
return A HealthCloud Contact object.
fun getContactPointAddress (msg, accountId)
Converts the provided ADT request message to the HealthCloud ContactPoint Address objectlist.
param
msgis an ADT message.
paramaccountIdis a string with the Account Id.
return A HealthCloud ContactPoint Address object list.
fun getContactPointPhone (msg, accountId)
Converts the provided ADT request message to the HealthCloud ContactPointPhone object list.
param
msgis an ADT message.
paramaccountIdis a string with the Account Id.
return A HealthCloud ContactPointPhone object list.
fun hcConvertContactPointPhone (pid)
Converts the provided PID segment to a list of FHIR formatted ContactPoint objects.
param
pidis a HL7 PID segment to get the contact info from.
return A list of FHIR formatted ContactPoint objects.
fun getClinicalEncounter (msg, admissionTypeCodeSetBundleId, dischargeDispositionCodeSetBundleId)
Converts the provided ADT request message to the HealthCloud ClinicalEncounter object.
param
msgis an ADT message.
paramadmissionTypeCodeSetBundleIdis a string with the admission type CodeSetBundle Id to set for TypeId.
paramdischargeDispositionCodeSetBundleIdis a string with the discharge disposition CodeSetBundle Id.
return A HealthCloud ClinicalEncounter object.
fun mapEncounterClass (pv1_02)
This function creates the Encounter Class object.
param
pv1_02is the PV1-01 object.
return An Encounter Class object.
fun mapClinicalEncounterCategory (val)
Maps the value for PV1-02 to a matching ClinicalEncounter Category or sets as Unknown if a suitable one can't be matched.
param
valis the PV1-02 value.
return A HealthCloud picklist value for ClinicalEncounter Category.
fun mapServiceType (val)
Maps the value for PV1-10 to a matching ClinicalEncounter ServiceType.
param
valis the PV1-10 value.
return A HealthCloud picklist value for ClinicalEncounter ServiceType.
fun mapAdmissionSource (val)
Maps the value for PV1-14 to a matching ClinicalEncounter AdmissionSource.
param
valis the PV1-14 value.
return A HealthCloud picklist value for ClinicalEncounter AdmissionSource.
fun mapCodeableConceptReadmissionIndicator (code)
This function maps the provided code to the appropriate codeableconcept object for Encounter Readmission Indicator. This function is provided as a pointer to mapCodeableConcept.
param
codeis the PV1-13 CWE-01 value.
return A CodeableConcept object.
fun mapCodeableConceptEncounterPriority (code)
This function maps the provided code to the appropriate codeableconcept object for Encounter Priority. This function is provided as a pointer to mapCodeableConcept.
param
codeis the PV2-25 CWE-01 value.
return A CodeableConcept object.
fun getClinicalEncounterFacility (msg, facilityId)
Converts the provided ADT request message to the HealthCloud ClinicalEncounterFacility object.
param
msgis an ADT message.
paramfacilityIdis the HC facility Id to use.
return A HealthCloud ClinicalEncounterFacility object.
fun getClinicalEncounterProvider (msg, attendingDoctorIds, referringDoctorIds, consultingDoctorIds, admittingDoctorIds)
Converts the provided ADT request message to the HealthCloud ClinicalEncounterProvider object list.
param
msgis an ADT message.
paramattendingDoctorIdsis a list of Practitioner Ids for attending doctors.
paramreferringDoctorIdsis a list of Practitioner Ids for referring doctors.
paramconsultingDoctorIdsis a list of Practitioner Ids for consulting doctors.
paramadmittingDoctorIdsis a list of Practitioner Ids for admitting doctors.
return A HealthCloud ClinicalEncounterProvider object list.
fun getClinicalEncounterIdentifier (msg)
Converts the provided ADT request message to the HealthCloud ClinicalEncounterIdentifier object.
param
msgis an ADT message.
return A HealthCloud ClinicalEncounterIdentifier object.
fun getClinicalEncounterReason (msg, reasonCodeCodeSetBundleId)
Converts the provided ADT request message to the HealthCloud ClinicalEncounterReason object.
param
msgis an ADT message.
paramreasonCodeCodeSetBundleIdis the CodeSetBundle Id of the reason code.
return A HealthCloud ClinicalEncounterReason object.
fun getClinicalAlert (msg, clinicalAlertCodeSetBundleId, accountId, codeSetUndefined)
Converts the provided ADT request message to the HealthCloud ClinicalAlert object.
param
msgis an ADT message.
paramclinicalAlertCodeSetBundleIdis the CodeSetBundle Id of the clinical alert.
paramaccountIdis a string with the Account Id.
paramcodeSetUndefinedis the CodeSetBundle undefined value to be used when no value is available.
return A HealthCloud ClinicalAlert object.
fun getAllergyIntolerance (msg, allergyCodeCodeSetBundleId, accountId)
Converts the provided ADT request message to the HealthCloud AllergyIntolerance object.
param
msgis an ADT message.
paramallergyCodeCodeSetBundleIdis the CodeSetBundle for the Allergy CodeId.
paramaccountIdis a string with the Account Id.
return A HealthCloud AllergyIntolerance object.
fun getPatientHealthReaction (msg, manifestedSymptomCodeSetBundleId)
Converts the provided ADT request message to the HealthCloud PatientHealthReaction object.
param
msgis an ADT message.
parammanifestedSymptomCodeSetBundleIdis the Manifested Symptom CodeSetBundle Id to use.
return A HealthCloud PatientHealthReaction object.
fun getCareObservation (msg, accountId, clinicalEncounterId, idTypeIdMap, unitOfMeasureMap, valueInterpretationCodeSetBundleIds, methodIdCodeSetBundleIds, codeSetUndefined)
Converts the provided ADT request message to the HealthCloud CareObservation object list.
param
msgis an ADT message.
paramaccountIdis a string with the Account Id.
paramclinicalEncounterIdis a string with the ClinicalEncounter Id.
paramidTypeIdMapis an object with the CodeSet values.
paramunitOfMeasureMapis an object with the unit of measure name to the Id for lookup.
paramvalueInterpretationCodeSetBundleIdis the CodeSetBundle Id list for ValueInterpretation.
parammethodIdCodeSetBundleIdsis the CodeSetBundle Id list for MethodId.
paramcodeSetUndefinedis the CodeSetBundle undefined value to be used when no value is available.
return A HealthCloud CareObservation object list.
fun mapObxTypeAndValue (obx)
Maps the provided OBX segment to it's proper ObservedValueType and value in CareObservation.
param
obxis an OBX segment to map.
return An object with the CareObservation fields.
fun getCareObservationComponentAttachments (msg)
Converts the provided ADT request message to the HealthCloud Attachment object list.
param
msgis an ADT message.
return A HealthCloud Attachment object list.
fun mapAttachmentValue (obx)
Maps the provided OBX segment to it's proper ContentType and Body in HC Attachment.
param
obxis an OBX segment to map.
return An object with the Attachment fields.
fun getCareObservationComponent (msg, unitOfMeasureMap, componentTypeIdCodeSetBundleIds, codeSetBundleUndefined)
Converts the provided ADT request message to the HealthCloud CareObservationComponent object list.
param
msgis an ADT message.
paramunitOfMeasureMapis an object with the unit of measure name to the Id for lookup.
paramcomponentTypeIdCodeSetBundleIdsis a list of component type Ids.
paramcodeSetBundleUndefinedis the undefined value to use for ComponentTypeCodeId if none is available.
return A HealthCloud CareObservationComponent object list.
maritalstatus
Maps the marital status object.
Source:
.src/main/resources/dw/resources/codesystem/maritalstatus.dwl
Functions
fun mapMaritalStatus (code: String)
Maps the marital status with the provided code.
param
codeis a string with the status.
return A MaritalStatus object.
nametype
Maps the name type object.
Source:
.src/main/resources/dw/resources/codesystem/nametype.dwl
Functions
fun mapNameType (code: String)
Maps the name type with the provided code.
param
codeis a string with the status.
return A NameType object.
telecomequipmenttype
Maps the Telecom Equipment Type object.
Source:
.src/main/resources/dw/resources/codesystem/telecomequipmenttype.dwl
Functions
fun mapTelecomEquipmentType (code)
Maps the provided XAD-07 field to the proper Telecom Equipment Type object.
param
codeis a XTN-03 field to map.
return An telecom equipment type object or null if not found.
telecomusecode
Maps the telecom use code object.
Source:
.src/main/resources/dw/resources/codesystem/telecomusecode.dwl
Functions
fun mapTelecomUseCode (code: String)
Maps the telecom use code with the provided code.
param
codeis a string with the code to map.
return A TelecomUseCode object.
util
This module defines a number of common
utility functions.
Source:
.src/main/resources/dw/resources/util.dwl
Functions
fun mapGuid (InStr: String)
Generates a GUID with the provided string. This is helpful because the GUID generated is predictable.
param
InStris the input string to the hash function.
return A string with the predictable hashed value.
fun toString (data)
Converts anything to a JSON string representation. Note that if you are serializing an object datetime fields may have local timezone information so this can cause issues with repeatability for munit tests.
param
datais the data type to convert to JSON.
return A JSON formatted string of the provided variable.
fun hl7ConvertDateTime (timeStr)
Converts a HL7 datetime string to the expected datetime string.
param
timeStris a HL7 datetime string formatted YYYYMMDDHHMMSS.
return A timestamp string formatted YYYY-MM-DDTHH:MM:SS.000Z.
fun hl7ConvertDate (dateStr)
Converst a HL7 date to date string.
param
dateStris a HL7 date string formatted YYYYMMDD.
return A date string formatted YYYY-MM-DD.
fun removeNull (arr: Array)
Removes all null items from an array.
param
arris an array.
return An array with null items removed.
fun removeNull (obj: Object)
Removes all null values from an object.
param
objis an object.
return An object with null values removed.
fun clean (obj: Object)
Cleans the provided object of blank strings, null values, empty objects, and empty arrays.
param
objis an Object to clean.
return A cleaned object.
fun clean (arr: Array)
Cleans the provided array of blank strings, null values, empty objects, and empty arrays.
param
arris an Array to clean.
return A cleaned Array.
fun strip (item, key: String)
Recursively strips the provided key name from any objects in the provided item.
param
itemis an value.
paramkeyis a String with the object key name to strip.
return The provided value with any instances of the key removed.
fun toEpochSeconds (str)
Converts the provided HL7 datetime string and converts it to a number with the number of seconds since epoch.
param
stris a HL7 datetime string.
return A number with number of seconds since epoch.
fun fromEpochSeconds (seconds)
Converts the provided datetime as a number with seconds since epoch into the FHIR formatted datetime string.
param
secondsis a number with the seconds since epoch.
return A string with the FHIR formatted datetime string.
fun replacePair (obj: Object, key: String, val)
Replaces a key value pair in an object with the provided object and key value set.
param
objis an object to replace in.
paramkeyis a string to match on.
paramvalis the value to replace with.
return An object with the replaced pair or null if no object is provided.